﻿namespace K9Nano.Resources;

/// <summary>
/// 资源访问管理接口
/// </summary>
public interface IResourceManager
{
    /// <summary>
    /// 当前用户根据ID获取资源
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="id">资源ID</param>
    /// <returns>资源存在且有访问权限时，返回资源对象；否则，返回null</returns>
    T? Get<T>(string id) where T: IResource;

    /// <summary>
    /// 对资源进行权限保护
    /// </summary>
    /// <param name="resource">资源</param>
    /// <param name="expires">保护有效期</param>
    void Protect(IResource resource, TimeSpan expires);
}